Skip to content

fix: i18n ICU expression ordering with pipes#5

Merged
Brooooooklyn merged 1 commit intomainfrom
02-04-fix_i18n_icu_expression_ordering
Feb 4, 2026
Merged

fix: i18n ICU expression ordering with pipes#5
Brooooooklyn merged 1 commit intomainfrom
02-04-fix_i18n_icu_expression_ordering

Conversation

@Brooooooklyn
Copy link
Copy Markdown
Member

@Brooooooklyn Brooooooklyn commented Feb 4, 2026

R3Icu used HashMap for vars and placeholders, which does not preserve insertion order. JavaScript objects (used in Angular's ngtsc) do preserve insertion order. When ICU cases share interpolation expressions, the HashMap's non-deterministic iteration caused pipe expressions to be emitted before plain expressions in the i18nExp chain.

Changed R3Icu.vars and R3Icu.placeholders from HashMap to ordered Vec<(Atom, ...)> with deduplication helpers matching JS object semantics.


Note

Medium Risk
Touches i18n/ICU compilation and changes ordering semantics used to generate update expressions, which could affect emitted templates for plural/select blocks. Scope is limited and covered by new ordering-focused integration tests.

Overview
Ensures deterministic i18n ICU expression ordering (especially when pipes are involved) by changing R3Icu.vars and R3Icu.placeholders from HashMap to ordered Vec<(Atom, ...)>.

Updates the HTML→R3 ICU extraction to use ordered insert/update helpers that preserve first-insertion order (JS object semantics) while still de-duping keys, and adjusts tests to parse templates with expansion forms enabled plus new cases asserting i18nExp chaining order for mixed plain/pipe expressions (including ICU plural).

Written by Cursor Bugbot for commit 059b89f. This will update automatically on new commits. Configure here.

R3Icu used HashMap for vars and placeholders, which does not preserve
insertion order. JavaScript objects (used in Angular's ngtsc) do preserve
insertion order. When ICU cases share interpolation expressions, the
HashMap's non-deterministic iteration caused pipe expressions to be
emitted before plain expressions in the i18nExp chain.

Changed R3Icu.vars and R3Icu.placeholders from HashMap to ordered
Vec<(Atom, ...)> with deduplication helpers matching JS object semantics.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
@Brooooooklyn Brooooooklyn force-pushed the 02-04-fix_i18n_icu_expression_ordering branch from 5cdc30b to 059b89f Compare February 4, 2026 04:49
@Brooooooklyn Brooooooklyn merged commit 9797271 into main Feb 4, 2026
3 checks passed
@Brooooooklyn Brooooooklyn deleted the 02-04-fix_i18n_icu_expression_ordering branch February 4, 2026 05:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant